$('.tablelist tbody tr:odd').addClass('odd');

var vm = new Vue({
    el: "#contactslist",
    data:
        {
            nowDeptId: '',
            deptlist: '',
            messages: '',
            pageModel: '',
        },
    methods: {
        send() {
            var staffId = $("#staffId").val();
            var name = $("#name").val();
            var deptId = $("#deptId").val();
            axios({
                method: 'post',
                url: 'http://localhost:8099/tbStaff/list',
                params: {
                    "staffId": staffId,
                    "name": name,
                    "deptId": deptId,
                    "pageNum": this.pageModel.pageNum,
                    "pageSize": this.pageModel.pageSize,
                },
            }).then(function (res) {
                vm.messages = res.data.data;
                vm.pageModel = res.data;
            }).catch(function (reason) {
                console.log(reason);
            })
        },
        lunbo: function (ele) {
            vm.pageModel.pageNum = ele;
            vm.nowDeptId= $("#deptId").val();
            staffId = $("#staffId").val();
            name = $("#name").val();
            deptId = $("#deptId").val();
            this.send();
        },
        getDeptList:function (){
            axios({
                method: 'post',
                url: 'http://localhost:8099/tbStaff/getFdept',
            }).then(function (res) {
                vm.deptlist = res.data;
            }).catch(function (reason) {
                console.log(reason);
            })
        },
        toExcel(){
            var staffId = $("#staffId").val();
            var name = $("#name").val();
            var deptId = $("#deptId").val();
            window.location.href="http://localhost:8099/tbStaff/download?staffId="+staffId+"&name="+name+"&deptId="+deptId+"&pageNum="+vm.pageModel.pageNum+"&pageSize="+vm.pageModel.pageSize;
        },
    },
    //页面加载完自动执行
    mounted() {
        this.getDeptList();
        this.send();
    }
});